package com.oracle.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.oracle.common.StatusCompent;
import com.oracle.entity.TaskType;
import com.oracle.mapper.TaskTypeMapper;
import com.oracle.service.TaskTypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author
 * @since 2025年05月15日
 */
@Service
public class TaskTypeServiceImpl extends ServiceImpl<TaskTypeMapper, TaskType> implements TaskTypeService {

    @Autowired
    private TaskTypeMapper taskTypeMapper;

    @Override
    public List<TaskType> findAll() {
        //业务 检索时 可以加条件
        //状态值 1 表示启用 状态值 2 表示禁用
        //方式1：QueryWapper
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.select("id","name");
        queryWrapper.eq("state", StatusCompent.TASK_TYPE_STATUS);
        List list = taskTypeMapper.selectList(queryWrapper);

        //方式2：QueryWapper
//        QueryWrapper<TaskType> queryWrapper = new QueryWrapper<TaskType>();
//        queryWrapper.lambda().eq(TaskType::getState,StatusCompent.TASK_TYPE_STATUS);
//        List list = taskTypeMapper.selectList(queryWrapper);

        //方式3：LambdaQueryWrapper
//        LambdaQueryWrapper<TaskType> lambdaQueryWrapper = new LambdaQueryWrapper<TaskType>();
//        lambdaQueryWrapper.select(TaskType::getId,TaskType::getName);
//        lambdaQueryWrapper.eq(TaskType::getState,StatusCompent.TASK_TYPE_STATUS);
//        List list = taskTypeMapper.selectList(lambdaQueryWrapper);


        return list;
    }
}
